import httpClient from '../utils/request'

/**
 * User API functions
 */

interface ProfileData {
  nickName?: string;
  gender?: number;
  avatar?: string;
  address?: string;
  email?: string;
}

/**
 * Get user profile by userId
 * @param userId - The user ID
 * @returns The user profile data
 */
export const getUserProfile = (userId: number) => {
  return httpClient.get(`/user/profile/${userId}`)
}

/**
 * Update user profile
 * @param userId - The user ID
 * @param profileData - The profile data to update
 * @returns The updated user profile
 */
export const updateUserProfile = (userId: number, profileData: ProfileData) => {
  return httpClient.put(`/user/profile/${userId}`, profileData)
}

/**
 * Update user avatar
 * @param userId - The user ID
 * @param avatar - The avatar URL
 * @returns The updated user profile
 */
export const updateUserAvatar = (userId: number, avatar: string) => {
  return httpClient.put(`/user/profile/${userId}`, { avatar })
}

export default {
  getUserProfile,
  updateUserProfile,
  updateUserAvatar
} 